package org.example.curriculum_design_6_16.mapper;

import org.apache.ibatis.annotations.*;
import org.apache.ibatis.annotations.Mapper;
import org.example.curriculum_design_6_16.entity.pojo.PaperScoringRule;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

import java.util.List;

/**
* @author 郑凯
* @description 针对表【paper_scoring_rule(论文评分规则表)】的数据库操作Mapper
* @createDate 2025-06-23 09:55:28
* @Entity org.example.curriculum_design_6_16.entity.pojo.PaperScoringRule
*/
@Mapper
public interface PaperScoringRuleMapper extends BaseMapper<PaperScoringRule> {
    @Insert("INSERT INTO paper_scoring_rule(paper_type, description, base_score, senior_multiplier, effective_date) " +
            "VALUES(#{paperType}, #{description}, #{baseScore}, #{seniorMultiplier}, #{effectiveDate})")
    @Options(useGeneratedKeys = true, keyProperty = "id")
    int insertPaperScoringRule(PaperScoringRule rule);

    @Update("UPDATE paper_scoring_rule SET " +
            "paper_type=#{paperType}, description=#{description}, base_score=#{baseScore}, " +
            "senior_multiplier=#{seniorMultiplier}, effective_date=#{effectiveDate} " +
            "WHERE id=#{id}")
    int updatePaperScoringRule(PaperScoringRule rule);

    @Delete("DELETE FROM paper_scoring_rule WHERE id=#{id}")
    int deletePaperScoringRuleById(Integer id);

    @Select("SELECT * FROM paper_scoring_rule WHERE id=#{id}")
    PaperScoringRule getPaperScoringRuleById(Integer id);

    @Select("SELECT * FROM paper_scoring_rule")
    List<PaperScoringRule> getAllPaperScoringRules();

    @Select("SELECT * FROM paper_scoring_rule WHERE paper_type=#{paperType}")
    PaperScoringRule getPaperScoringRuleByType(String paperType);

    @Select("SELECT paper_type FROM paper_scoring_rule")
    List<String> getAllPaperScoringRuleTypes();
}




